package com.abl.core.service.sys;

import com.abl.core.domain.db.SysDict;
import com.abl.core.domain.project.PageSearch;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.mybatisflex.core.paginate.Page;

import java.util.List;

/**
 * 字典服务
 */
public interface SysDictService {
    /**
     * 新增
     */
    boolean insert(SysDict param);

    /**
     * 删除
     */
    boolean delete(String ids);

    /**
     * 修改
     */
    boolean update(SysDict param);

    Page<SysDict> page(SysDict param, PageSearch pageSearch);

    /**
     * 查询详情
     */
    JSONObject info(SysDict param);

    void clearCache();

    /**
     * 查询集合
     */

    List<SysDict> list(SysDict param);

    SysDict getDict(String dictKey);

    String getString(String dictKey);

    String getString(String dictKey, String defaultValue);

    int getInt(String dictKey);

    int getInt(String dictKey, int defaultValue);

    long getLong(String dictKey);

    long getLong(String dictKey, long defaultValue);

    JSONObject getJSONObject(String dictKey);

    JSONObject getJSONObject(String dictKey, JSONObject defaultValue);


    JSONArray getJSONArray(String dictKey);

    JSONArray getJSONArray(String dictKey, JSONArray defaultValue);


    <T> T getOne(String dictKey, Class<T> tClass);

    <T> T getOne(String dictKey, Class<T> tClass, T defaultValue);


    <T> List<T> getList(String dictKey, Class<T> tClass);

    <T> List<T> getList(String dictKey, Class<T> tClass, List<T> defaultValue);

    List<SysDict> allDict();

    List<SysDict> allDictEnum(SysDict param);

//    List<SysDict> listByKey(String key);
}
